<?php
class Util_User
{
    /**
     * User object
     * @var <type>
     */
    private static $_user = null;

    /**
     * Get singleton instance
     */
    public static function getInstance()
    {
        if ( is_null(self::$_user) )
        {
            self::init();
        }//end if

        //Return
        return self::$_user;
    }

    /**
     * Init
     */
    protected static function init()
    {
        $storage    = new Zend_Session_Namespace(SESSION_NAMESPACE);
        if ( !$storage->user )
        {
            $storage->user->userid      = '-1';
            $storage->user->username    = 'guest';
            $storage->user->email       = '';
            $storage->user->firstname   = '';
            $storage->user->lastname    = '';
            $storage->user->fullname    = '';
            $storage->user->logged      = false;
            $storage->user->lang        = 'vn';
        }//end if
        self::$_user = $storage->user;
    }
}